package cn.wolfcode.crm5.controller;

import cn.wolfcode.crm5.annotation.RequiredPermission;
import cn.wolfcode.crm5.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private IDepartmentService departmentService;

    @RequestMapping("/list")
    @RequiredPermission(name = "部门列表",expression = "department:list")
    public String list(Model model){
        model.addAttribute("departments",departmentService.list());

        return "/department/list";
    }
}
